home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / bbs / fcfgw40s.zip / SORTWAIT.CPP < prev    next >
C/C++ Source or Header  |  1996-04-21  |  2KB  |  115 lines

  1. // SortWait.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "FileCFG.h"
  6. #include "SortWait.h"
  7.  
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13.  
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CSortWait dialog
  16.  
  17.  
  18. CSortWait::CSortWait()
  19. {
  20.     //{{AFX_DATA_INIT(CSortWait)
  21.         // NOTE: the ClassWizard will add member initialization here
  22.     //}}AFX_DATA_INIT
  23.     m_bParentDisabled = FALSE;
  24. }
  25.  
  26. CSortWait::~CSortWait()
  27. {
  28.     if( m_hWnd != NULL ) DestroyWindow();
  29. }
  30.  
  31. BOOL CSortWait::DestroyWindow()
  32. {
  33.     ReEnableParent();
  34.     return CDialog::DestroyWindow();
  35. }
  36.  
  37. void CSortWait::OnCancel()
  38. {
  39. }
  40.  
  41. void CSortWait::ReEnableParent()
  42. {
  43.     if( m_bParentDisabled && (m_pParentWnd != NULL) )
  44.         m_pParentWnd->EnableWindow(TRUE);
  45.     m_bParentDisabled=FALSE;
  46. }
  47.  
  48. void CSortWait::DoDataExchange(CDataExchange* pDX)
  49. {
  50.     CDialog::DoDataExchange(pDX);
  51.     //{{AFX_DATA_MAP(CSortWait)
  52.     DDX_Control(pDX, IDC_PROGRESS_SORT_WAIT, m_Progress);
  53.     DDX_Control(pDX, IDC_ANIMATE_SORT_WAIT, m_Animation);
  54.     //}}AFX_DATA_MAP
  55. }
  56.  
  57.  
  58. BEGIN_MESSAGE_MAP(CSortWait, CDialog)
  59.     //{{AFX_MSG_MAP(CSortWait)
  60.     //}}AFX_MSG_MAP
  61. END_MESSAGE_MAP()
  62.  
  63. /////////////////////////////////////////////////////////////////////////////
  64. // CSortWait message handlers
  65.  
  66. BOOL CSortWait::OnInitDialog() 
  67. {
  68.     CDialog::OnInitDialog();
  69.     
  70.     VERIFY(m_Animation.Open(IDR_AVI_WAIT));
  71.     m_Progress.SetStep(1);    
  72.     return TRUE;
  73. }
  74.  
  75.  
  76. BOOL CSortWait::Create(CWnd* pParent)
  77. {
  78.     m_pParentWnd = CWnd::GetSafeOwner(pParent);
  79.  
  80.     if( (m_pParentWnd!=NULL) && m_pParentWnd->IsWindowEnabled() ){
  81.       m_pParentWnd->EnableWindow(FALSE);
  82.       m_bParentDisabled = TRUE;
  83.     }
  84.  
  85.     if(!CDialog::Create(CSortWait::IDD,pParent))
  86.     {
  87.       ReEnableParent();
  88.       return FALSE;
  89.     }
  90.  
  91.     return TRUE;
  92. }
  93.  
  94. void CSortWait::StepIt()
  95. {
  96.     PumpMessages();
  97.     m_Progress.StepIt();
  98. }
  99.  
  100. void CSortWait::PumpMessages()
  101. {
  102.     // Must call Create() before using the dialog
  103.     ASSERT(m_hWnd!=NULL);
  104.  
  105.     MSG msg;
  106.     // Handle dialog messages
  107.     while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
  108.     {
  109.       if(!IsDialogMessage(&msg))
  110.       {
  111.         TranslateMessage(&msg);
  112.         DispatchMessage(&msg);  
  113.       }
  114.     }
  115. }